import java.lang.reflect.InvocationTargetException;
import java.util.ArrayList;
import java.util.Iterator;
import java.util.Map.Entry;
import java.util.Set;
import java.util.concurrent.ConcurrentHashMap;

import org.apache.commons.beanutils.BeanUtils;
import org.junit.Test;

import com.bestseller.bean.Address;
import com.bestseller.bean.Person;

public class JavaTest {
	@Test
	public void test01(){
		ArrayList<Integer> list = new ArrayList<Integer>();
        list.add(2);
        Iterator<Integer> iterator = list.iterator();
        while(iterator.hasNext()){
            Integer integer = iterator.next();
            if(integer==2)
                list.remove(integer);
        }
	}
	
	@Test
	public void test02(){
		ConcurrentHashMap<String,String>chm=new ConcurrentHashMap<String,String>();
		chm.put("name", "xianggaoxiong");
		chm.put("age", "18");
		Set<Entry<String, String>> entrySet = chm.entrySet();
		for(Entry<String, String> entry:entrySet){
			System.out.println(entry.getKey()+":"+entry.getValue());
		}
	}
	
	@Test
	public void test03(){
		Address adress=new Address();
		adress.setId(123);
		adress.setName("仙桃");
		Person preson=new Person();
		preson.setName("向高熊");
		preson.setAge(24);
		preson.setAddress(adress);
		
		Person person2=new Person();
		try {
			BeanUtils.copyProperties(person2, preson);
		} catch (Exception e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}
		
		System.out.println(person2.getAddress().getName());
	}
}
